﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using Gmis.Public;

namespace Gmis.Web.UI
{
    public partial class NewsSearch : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Page.IsPostBack) return;
            string keyword = CommonFunction.getRequestValue("keyword").Trim();
            ltl_Info.Text = SearchResult(keyword);
        }

        private string SearchResult(string str )
        {
            BLL.News bll = new BLL.News();
            List<Model.News> models = bll.GetModelList(" sTitle Like '%" + str + "%' ");
            if(models ==null) return "";
            string htmlStr = "";
            foreach(Model.News model in models)
            {
              string sTemp ="<ul><li><a href=\"NewsDetail.aspx?type=&sId={0}\" target=\"_blank\">{1}</a></li></ul>";
              htmlStr += string.Format(sTemp, model.sId, model.sTitle);
            }
            return htmlStr;
        }

       
    }
}